import { request } from "@utils/http";

export function getRoleListRes(page: number, limit: number, roleName?: string){
    return request.get<any, any>("/admin/acl/role/" + `${page}/${limit}?roleName=${roleName}`)
}

export function addRoleRes(data:any){
    if(data.id){
        return request.put("/admin/acl/role/update",data)
    }else{
        return request.post("/admin/acl/role/save",data)
    }
    
}

export function deleteRoleRes(id:string){
    return request.delete("/admin/acl/role/remove/"+id)
}


export function getAllTreeRes(id:string){
    return request.get<any,any>("/admin/acl/permission/toAssign/"+id)
}

export function setRoleTreeRes(roleId:string,permissionId:string){
    return request.post("/admin/acl/permission/doAssign",{},{
        params:{
            roleId,
            permissionId
        }
    })


}